<h2>管辖小区维护</h2> 
<style>
body{
  background: #d2d2d2;
}
</style>  
<%= form_tag('/new_node', method: :post, :role=>"form") do %>
 <table width="100%" align="center" cellpadding="0" cellspacing="0" class="table">
    <tr>
        <td class="eheader">机构名称</td>
        <td>
          <%=@section_name %>
          <input type="hidden" name="section_id" value=<%=@section_id %>  /> 
        </td>
    </tr>    
    <tr>
       <td class="eheader" width="20%">请选择管辖小区<font color="red">*</font></td>
        <td>
              <table width="100%" border="1">                           
                   <% i=0%>
                   <% a=1%>
                   <% rowcount=@dev_sn.size/2+@dev_sn.size%2%>
                   <%dev_sum=@dev_sn.size%>                 
                   <% while (a<=rowcount) %>
                       <tr>
                                     <td> 
                                        <div class="checkbox " style="margin-left:15px">
                                              <%if i<=dev_sum -1%>                                              
                                                     <label >
                                                        <% if ischekck(@section_id,@dev[i]["id"]) ==0%>
                                                           <input type="checkbox" id="checkid" name="note[]" value="<%= @dev[i]["id"] %>"/>
                                                           <%=@dev[i]["name"] %>  <%= @dev[i]["id"] %>
                                                        <%else%>
                                                            <input type="checkbox" id="checkid" name="note[]" value="<%= @dev[i]["id"]%>" checked/>
                                                           <%=@dev[i]["name"] %>  <%= @dev[i]["id"] %>
                                                        <%end%> 
                                                     </label>                                        
                                              <% end %>     
                                        </div>                 
                                     </td>
                                <%i=i+1%>                                  
                                      <td>
                                         <div class="checkbox " style="margin-left:15px">
                                              <%if i<=dev_sum -1%>                                           
                                                    <label >
                                                        <% if ischekck(@section_id,@dev[i]["id"]) ==0%>
                                                           <input type="checkbox" id="checkid" name="note[]" value="<%= @dev[i]["id"] %>"/>
                                                           <%=@dev[i]["name"] %>  <%= @dev[i]["id"] %>
                                                        <%else%>
                                                            <input type="checkbox" id="checkid" name="note[]" value="<%= @dev[i]["id"]%>" checked/>
                                                           <%=@dev[i]["name"] %>  <%= @dev[i]["id"] %>
                                                        <%end%> 
                                                    </label>   
                                              <% end %>     
                                         <div>            
                                       </td>

                      </tr>
                        <%i=i+1%>
                       <% a=a+1%>                                 
                  <% end %>
             </table>
        </td>
    </tr>
</table>
 <div class="modal-footer">
                <button type="reset" class="btn btn-default" >
                             消除
                        </button>
                <button type="submit" class="btn btn-primary" onclick ="return Check_new();" >
                             提交
                        </button>
              </div>
<%end%>   
<div class="WhereToLinks"></div>
 <% content_for :javascript_head do %>  
       <script type="text/javascript">
            function Check_new(){
                var arr=document.getElementsByName("note[]");
                var len=0;
                for (i=0;i<arr.length;i++)
                {
                    if (arr[i].checked )
                      { len++}
                }
                if (len<1)
                 {   
                   alert("请选择小区")
                   return false
                 }
                
            }
       </script>
 <% end %>